import Vue from "vue";

import "normalize.css/normalize.css"; // A modern alternative to CSS resets

import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
import locale from "element-ui/lib/locale/lang/en"; // lang i18n

import "@/styles/index.scss"; // global css
import "@/assets/iconfont/iconfont.css";

import App from "./App";
import store from "./store";
import router from "./router";

import "@/icons"; // icon
import "@/permission"; // permission control
import i18n from "./i18n/index";
import "@/utils/extend";
import "@/enums/index";

import "xe-utils";
import VXETable from "vxe-table";
import "vxe-table/lib/style.css";
import "@/utils/filters";

Vue.use(ElementUI, { size: 'small' });
Vue.use(VXETable);

VXETable.interceptor.add("event.clearActived", (params) => {
  const { $event } = params;
  let ignoreClassNames = [
    "el-input__inner",
    "vxe-table–ignore-clear",
    "el-select-dropdown__item",
    "el-input__suffix-inner",
    "el-tree-node__label",
    "el-select-dropdown__item hover",
    "el-picker-panel__content",
    "el-picker-panel__header",
    "el-picker-panel__icon-btn",
    "el-date-picker__header-label",
    "el-year-table",
    "cell"
  ];
  let elmentClass = $event.target.className;
  let firstElClass = $event.target.parentElement.className;
  let secondElClass = $event.target.parentElement.parentElement.className;
  // 比如点击了某个组件的弹出层面板之后，此时被激活单元格不应该被自动关闭，通过返回 false 可以阻止默认的行为。
  for (let i = 0; i < ignoreClassNames.length; i++) {
    let ignoreClassName = ignoreClassNames[i];
    if (
      elmentClass.indexOf(ignoreClassName) > -1 ||
      firstElClass.indexOf(ignoreClassName) > -1 || secondElClass.indexOf(ignoreClassName) > -1
    )
      return false;
  }
});

import request from "@/utils/request";

Vue.prototype.$request = request;

Vue.config.productionTip = false;

new Vue({
  el: "#app",
  router,
  store,
  i18n,
  render: (h) => h(App),
});


